package com.sdgakj.utils.redissession.listener;

import org.apache.shiro.session.Session;
import org.apache.shiro.session.SessionListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.sdgakj.utils.redissession.session.CachingShiroSessionDao;

public class ShiroSessionListener implements SessionListener {


    private static final Logger logger = LoggerFactory.getLogger(ShiroSessionListener.class);

    private CachingShiroSessionDao sessionDao;

    @Override
    public void onStart(Session session) {
        // 会话创建时触发
    }

    @Override
    public void onStop(Session session) {
        sessionDao.delete(session);
    }

    @Override
    public void onExpiration(Session session) {
        sessionDao.delete(session);
    }

    public void setSessionDao(CachingShiroSessionDao sessionDao)
    {
        this.sessionDao = sessionDao;
    }
    
}
